Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable URL connection caching in SPIClassIterator #88586

Merged
merged 2 commits into from Jul 18, 2022

Conversation

ChrisHegarty
Copy link
Contributor

@ChrisHegarty ChrisHegarty commented Jul 18, 2022

This change disables URLConnection caching in SPIClassIterator - similar to what j.u.ServiceLoader does.

Resources accessed in jar file, through the URLConnection API, cache by default. In terms of JarURLConnections, this means retaining an open handle to the underlying jar file. This open handle is problematic when attempting to delete the jar file, on Windows. Disabling the jar file cache, for the URLConnections in SPIClassLoader should not negatively affect performance in any substantial way - since there are just a few service configuration files per jar.

The "workaround" here, disabling the cache per JAR URLConnection, is very common, and a consequence of the longstanding behaviour of the JarURLConnection API, as well as the URLClassLoader API.

closes #88275

@ChrisHegarty ChrisHegarty self-assigned this Jul 18, 2022
@ChrisHegarty ChrisHegarty added :Core/Infra/Plugins Plugin API and infrastructure Team:Core/Infra Meta label for core/infra team labels Jul 18, 2022
@ChrisHegarty ChrisHegarty changed the title Disable url connection caching in SPIClassIterator Disable URL connection caching in SPIClassIterator Jul 18, 2022
@ChrisHegarty ChrisHegarty marked this pull request as ready for review July 18, 2022 12:59
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra (Team:Core/Infra)

@elasticsearchmachine
Copy link
Collaborator

Hi @ChrisHegarty, I've created a changelog YAML for you.

Copy link
Member

@rjernst rjernst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@grcevski grcevski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@ChrisHegarty ChrisHegarty merged commit 5191a16 into elastic:master Jul 18, 2022
gmarouli pushed a commit to gmarouli/elasticsearch that referenced this pull request Jul 21, 2022
arteam pushed a commit to arteam/elasticsearch that referenced this pull request Jul 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>bug :Core/Infra/Plugins Plugin API and infrastructure Team:Core/Infra Meta label for core/infra team v8.4.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[CI] PluginsServiceTests classMethod failing
5 participants